import request from '../../utils/request'
export default {
  // 获取所有的权限列表
  reqPermissionList() {
    return request({
      method: 'GET',
      url: '/admin/acl/permission'
    })
  },

  // 新增菜单
  reqSavePermission(data) {
    return request({
      method: 'POST',
      url: '/admin/acl/permission/save',
      data
    })
  },

  // 给角色分配权限
  reqPermissionToRole(roleId, permissionId) {
    return request({
      method: 'POST',
      url: '/admin/acl/permission/doAssign',
      params: {
        roleId,
        permissionId
      }
    })
  },

  // 根据角色获取菜单
  reqGetAssignByRoleId(roleId) {
    return request({
      method: 'GET',
      url: `/admin/acl/permission/toAssign/${roleId}`
    })
  },

  // 修改菜单
  reqUpdatePermission(data) {
    return request({
      method: 'PUT',
      url: `/admin/acl/permission/update`,
      data
    })
  },

  // 递归删除菜单
  reqDeletePermission(id) {
    return request({
      method: 'DELETE',
      url: `/admin/acl/permission/remove/${id}`
    })
  }
}
